package com.ldg.crm.dao;

import com.ldg.crm.entity.ProductTypeEntity;
import com.ldg.crm.entity.ProductTypeEntityExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ProductTypeDao {
    /**
     *
     * @mbg.generated
     */
    @SelectProvider(type=ProductTypeEntitySqlProvider.class, method="countByExample")
    long countByExample(ProductTypeEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @DeleteProvider(type=ProductTypeEntitySqlProvider.class, method="deleteByExample")
    int deleteByExample(ProductTypeEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @Delete({
        "delete from crm_product_type",
        "where product_type_id = #{productTypeId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer productTypeId);

    /**
     *
     * @mbg.generated
     */
    @Insert({
        "insert into crm_product_type (product_type_id, name, ",
        "prod_type, product_feature)",
        "values (#{productTypeId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{prodType,jdbcType=VARCHAR}, #{productFeature,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="productTypeId", before=true, resultType=Integer.class)
    int insert(ProductTypeEntity record);

    /**
     *
     * @mbg.generated
     */
    @InsertProvider(type=ProductTypeEntitySqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="productTypeId", before=true, resultType=Integer.class)
    int insertSelective(ProductTypeEntity record);

    /**
     *
     * @mbg.generated
     */
    @SelectProvider(type=ProductTypeEntitySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="product_type_id", property="productTypeId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="prod_type", property="prodType", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_feature", property="productFeature", jdbcType=JdbcType.VARCHAR)
    })
    List<ProductTypeEntity> selectByExample(ProductTypeEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "product_type_id, name, prod_type, product_feature",
        "from crm_product_type",
        "where product_type_id = #{productTypeId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="product_type_id", property="productTypeId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="prod_type", property="prodType", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_feature", property="productFeature", jdbcType=JdbcType.VARCHAR)
    })
    ProductTypeEntity selectByPrimaryKey(Integer productTypeId);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductTypeEntitySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ProductTypeEntity record, @Param("example") ProductTypeEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductTypeEntitySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ProductTypeEntity record, @Param("example") ProductTypeEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductTypeEntitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ProductTypeEntity record);

    /**
     *
     * @mbg.generated
     */
    @Update({
        "update crm_product_type",
        "set name = #{name,jdbcType=VARCHAR},",
          "prod_type = #{prodType,jdbcType=VARCHAR},",
          "product_feature = #{productFeature,jdbcType=VARCHAR}",
        "where product_type_id = #{productTypeId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ProductTypeEntity record);
}